/**
 * postsshow 用 js
 */
using(['pc/js/components/ReadMode/ReadMode',
    'components/Comment/Comment',
    'pc/js/mod/posts/posts-show-relative',
    'utils/Lazyload',
    'components/InsertPost/InsertPost'], function(Read, Comment, Relative, Lazyload, InsertPost) {

var global = window;
var richWrapper = global.document.getElementById('richcontent');


// read mode
new Read().init('readmode', function(obj) {
    var str = richWrapper.innerHTML;
    obj.innerHTML = str;
});

// insert post
new InsertPost().process(richWrapper);

// comment
var loadComment = function() {
    global.USER_SDK.getInstance().getUserInfo(function(data){
        var c = new Comment({
            projectId: 1,
            postId: globalPostId,
            isLogin: data.isLogin,
            onLogin: function() {
                global.USER_SDK.getInstance().showLogin();
            },
            formAvatar: data.avatar
        });
        c.render('comment');
    });
};
new Lazyload(global.document.getElementById('comment')).once(loadComment);


// relative
new Relative({
    wrapperId: 'relativelist',
    postId: globalPostId,
    tags: globalPostTags
});

});

